package com.blog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.blog.bo.BlogMusicBO;
import com.blog.entity.BlogMusic;
import com.blog.service.MusicService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Huangzp
 * @Date 2022/1/10 15:05
 */
@Slf4j
@Service
public class MusicServiceImpl implements MusicService {


    @Autowired
    private BlogMusicBO blogMusicBO;

    @Override
    public List<BlogMusic> selectList(BlogMusic music) {
        QueryWrapper<BlogMusic> musicQueryWrapper = new QueryWrapper<>();
        musicQueryWrapper.lambda().eq(StringUtils.isNotBlank(music.getName()),BlogMusic::getName,music.getName())
                .eq(StringUtils.isNotBlank(music.getArtist()),BlogMusic::getArtist,music.getArtist());
        return blogMusicBO.list(musicQueryWrapper);
    }
}
